<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <div class="container-fluid">
    <a class="navbar-brand" href="#">蜗牛的博客</a>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent"
      aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav me-auto mb-2 mb-lg-0">
        <li class="nav-item">
          <a class="nav-link active" aria-current="page" href="/">首页</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="https://juejin.cn/user/2999123449747831/posts">掘金</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="https://gitee.com/snail_wn">Gitee</a>
        </li>
      </ul>

      {% if ctx.session.user %}
      <form class="d-flex" role="search">
        <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
        <button class="btn btn-outline-info" type="submit">Search</button>

        <!-- Example single danger button -->
        <div class="btn-group" style="margin:0 1rem;">
          <button type="button" class="btn btn-info dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
            {{ctx.session.user.name}}
          </button>
          <ul class="dropdown-menu dropdown-menu-end">
            <li><a class="dropdown-item" href="/create">写文章</a></li>
            <li><a class="dropdown-item" href="#">个人详情</a></li>
            <li><a class="dropdown-item" href="#">归档</a></li>
            <li>
              <hr class="dropdown-divider">
            </li>
            <li><a class="dropdown-item" href="/signout">退出</a></li>
          </ul>
        </div>
      </form>
      {% else %}
      <div class="btn-group" role="group" aria-label="Basic example">
        <a href="/signup">
          <button type="button" class="btn btn-info">注册</button>
        </a>
        <a href="/signin">
          <button type="button" class="btn btn-info">登录</button>
        </a>
      </div>
      {% endif %}
    </div>
  </div>
</nav>